// 轮播图
var swiper = new Swiper(".mySwiper", {
  spaceBetween: 30,
  effect: "fade",
  navigation: {
    nextEl: ".swiper-button-next",
    prevEl: ".swiper-button-prev",
  },
  pagination: {
    el: ".swiper-pagination",
    clickable: true,
  },
  autoplay: true,
});



// API
let lis = document.querySelectorAll(".Api ul li ");
lis.forEach(function (li) {
  //鼠标移入事件
  li.addEventListener("mouseover", function () {
    this.style.backgroundColor = "#1271ef";
    this.children[0].style.display = "none";
    this.children[1].style.display = " inline-block";
    this.style.color = '#fff'
  })
  li.addEventListener("mouseout", function () {
    this.style.backgroundColor = "#fff";
    this.children[0].style.display = "inline-block";
    this.children[1].style.display = "none";
    this.style.color = '#000'
  })
});

// 回到顶部
let active = document.querySelector('.icon-dingbudaohang-tongzhigonggao');
active.addEventListener('click', function () {
  let y = window.scrollY; //点击时获取到滚动条滚动的高度
  let timer = setInterval(function () {
    y -= 50;
    window.scrollTo(0, y);
    if (y <= 0) {
      clearInterval(timer); //当滚动条滚动到顶部时，清除定时器，结束动画
    }
  }, 20);
})

// 到一定高度显示
window.addEventListener('scroll', function() {
  if (window.scrollY > 300) {
    active.style.display = 'block'
  } else {
    active.style.display = 'none'
  }
})

// 助力
// 三个助力自动切换
let  divs= document.querySelectorAll(".help_conten>div");
index = 0;
setInterval(function(){
    index++;
    if(index==divs.length){
        index = 0;
    }
    divs.forEach(function(item){
        item.style.opacity = "0";
    })
    divs[index].style.opacity ="1"
},3000)
